/*
 * Copyright (c) 2024 Shenzhen Kaihong Digital Industry Development Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "sle_announce_hdi.h"
#include "sle_hal_errcode.h"
#include "sle_unit_test_log.h"

static SleAnnounceHdiCallbacks *g_announceHdiTestCbs = NULL;

SleHdiErrorCode SleHdiTestStartAnnounce(uint8_t announceId)
{
    g_announceHdiTestCbs->OnAnnounceStartCb(announceId, SLE_HDI_ERRCODE_SUCC);
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode SleHdiTestStopAnnounce(uint8_t announceId)
{
    g_announceHdiTestCbs->OnAnnounceStopCb(announceId, SLE_HDI_ERRCODE_SUCC);
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode SleHdiTestSetAnnounceData(uint8_t announceId, const SleAnnounceData *data)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(data != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "SleHdiTestSetAnnounceData");
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode SleHdiTestSetAnnounceParam(uint8_t announceId, const SleAnnounceParam *param)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(param != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "SleHdiTestSetAnnounceParam");
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode SleHdiTestRegisterAnnounceCallbacks(SleAnnounceHdiCallbacks *announceCallbacks)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(announceCallbacks != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "SleHdiTestRegisterAnnounceCallbacks");
    g_announceHdiTestCbs = announceCallbacks;
    return SLE_HDI_ERRCODE_SUCC;
}

SleHdiErrorCode GetSleAnnounceHdiOpts(SleAnnounceHdiOpts *announceOpts)
{
    SLE_UT_CHECK_AND_RETURN_RET_LOG(announceOpts != NULL, SLE_HDI_ERRCODE_INVALID_PARAM, "GetSleAnnounceHdiOpts");
    announceOpts->startAnnounce = SleHdiTestStartAnnounce;
    announceOpts->stopAnnounce = SleHdiTestStopAnnounce;
    announceOpts->setAnnounceData = SleHdiTestSetAnnounceData;
    announceOpts->setAnnounceParam = SleHdiTestSetAnnounceParam;
    announceOpts->registerAnnounceCbks = SleHdiTestRegisterAnnounceCallbacks;
    return SLE_HDI_ERRCODE_SUCC;
}
